<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__wsLog">
		
		<!-- 此文件为一个空的模板文件 -->
		
		<div id="message"  >
			<MarkdownPro
			v-model="mkValue"
			:height="400"
			@on-paste-image="onPasteImage"
			@on-ready="onReady"
			@on-copy="onCopy"
			@on-save="onSave"
			theme="light"
			/>	
			<el-button size="mini" @click="saveMk()">{{ $t('query') }}</el-button>
		</div>
	  
    </div>
  </el-card>
</template>

<script>
import { setMd5 } from '@/utils'
import Cookies from 'js-cookie'
import MarkdownPro  from 'vue-meditor'


export default {
  data () {
    return {
		theme:"light",
		mkValue:"[FastBoot-Vue](https://gitee.com/sunalee/fastboot-vue) Markdown by vue-meditor.  \n"
	}
  },
  mounted() {
	  
  },
  components: {
	  MarkdownPro 
  },
  methods:{
	onReady (data) {
		console.log(data)
	},
	onCopy (text) {
		console.log(text)
	},
	onPasteImage (pasteFile) {
		let formData = new FormData();
		formData.append('file', pasteFile);
		// 上传文件
		console.log(pasteFile)
		this.$http.post('/common/upload/uploadFile',formData).then(({ data: res }) => {
			if (res.code !== 200) {
				return this.$message.error(res.msg)
			}
			this.$message.success(res.msg)
			this.mkValue = this.mkValue + ( '!['+pasteFile.name+']('+res.data+')' )
		}).catch(() => {})
	},
	onSave (data) {
		console.log('------->' + JSON.stringify(data))
	},
	saveMk(){
		console.log('------->' + this.mkValue)
	}
  },
  destroyed () {
	  
  }
}
</script>

